import { getDeptSimpleList, getUserSimpleList } from '@/apis/common'
import { getProjectList } from '@/apis/project'

/**
 * 部门 picker 选项混入
 */
export const deptOptionsMixin = {
  data() {
    return {
      deptOptions: [],
    }
  },
  async created() {
    const { data } = await getDeptSimpleList()
    this.deptOptions = data
  },
}

/**
 * 用户 picker 选项混入
 */
export const userOptionsMixin = {
  data() {
    return {
      userOptions: [],
    }
  },
  async created() {
    const { data } = await getUserSimpleList()
    this.userOptions = data
  },
}

/**
 * 项目 picker 选项混入
 */
export const projectOptionsMixin = {
  data() {
    return {
      projectOptions: [],
    }
  },
  async created() {
    const { data } = await getProjectList()
    this.projectOptions = data.queryList
  },
}
